from classfile.attribute_info import AttributeInfo


class SignatureAttribute(AttributeInfo):
    def __init__(self, constantPool):
        super().__init__()
        self.constPool = constantPool
        self.signatureIndex = 0

    def readInfo(self, clsReader):
        self.signatureIndex = int.from_bytes(clsReader.readU16(), "big")

    @property
    def signature(self):
        return self.constPool.getUTF8(self.signatureIndex)
